home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 April: Mac OS SDK / Dev.CD Apr 98 SDK1.toast / Development Kits (Disc 1) / QuickDraw 3D / Samples / SampleCode / CommonSample / MyErrorHandler.c < prev    next >
Encoding:
Text File  |  1997-08-14  |  15.1 KB  |  378 lines  |  [TEXT/CWIE]

  1. // Quickdraw 3D sample code
  2. //
  3. // Nick Thompson, AppleLink: DEVSUPPORT (devsupport@applelink.apple.com)
  4. //
  5. // updated for 1.5.3 8/13/97
  6. //
  7. // ©1994-7 Apple Computer Inc., All Rights Reserved
  8.  
  9. #include <Dialogs.h>
  10. #include <Memory.h>
  11. #include <SegLoad.h>
  12. #include <TextUtils.h>
  13.  
  14. #include "QD3D.h"
  15. #include "QD3DErrors.h"
  16.  
  17. #include "MyErrorHandler.h"
  18.  
  19.  
  20. //---------------------------------------------------------------------------
  21.  
  22. const int kErrorHandlerAlertID = 21032 ;            // ID of the alert resource
  23.  
  24. //---------------------------------------------------------------------------
  25.  
  26. // THIS ENUM MUST MATCH THE STRUCT BELOW
  27. enum {
  28.     kWarningString,
  29.     kErrorString,
  30.     kFirstErrorString,
  31.     kLastErrorString,
  32.     kSpaceString,
  33.     kOpenParen,
  34.     kCloseParen,
  35.     kUnknownErrorString
  36. } ;
  37.  
  38.  
  39. // use these to construct intelligable messages
  40. static struct {
  41.     Str255        errorString ;
  42. } stringTable[] = {
  43.     "\pQuickDraw 3D warning.\r\r", 
  44.     "\pQuickDraw 3D Error.\r\r",
  45.     "\p\rFirst Error: ",
  46.     "\p\rLast Error: "
  47.     "\p ",
  48.     "\p(",
  49.     "\p)",
  50.     "\p\rUnknown Message"
  51. } ;
  52.  
  53.  
  54. //---------------------------------------------------------------------------
  55.  
  56.  
  57. /*
  58.     To generate these tables, copy/paste the error codes from QD3DErrors.h
  59.     and use this regexp:
  60.     
  61.     Find:        kQ3Error([0-9A-z]*),
  62.     Replace:    kQ3Error\1, "\\pkQ3Error\1",
  63.     
  64.     Find:        kQ3Warning([0-9A-z]*),
  65.     Replace:    kQ3Warning\1, "\\pkQ3Warning\1",
  66.     
  67.     Find:        kQ3Notice([0-9A-z]*),
  68.     Replace:    kQ3Notice\1, "\\pkQ3Notice\1",
  69.     
  70. */
  71.  
  72.  
  73. /* define a table for all of the QuickDraw 3D warning codes */
  74. struct {
  75.     TQ3Warning    theWarning ;
  76.     Str255        theString ;
  77. } warningTable[] = {
  78.     kQ3WarningNone,                             "\pkQ3WarningNone",
  79.     /* General System */
  80.     kQ3WarningInternalException,                 "\pkQ3WarningInternalException",    
  81.     /* Object Warnings */
  82.     kQ3WarningNoObjectSupportForDuplicateMethod, "\pkQ3WarningNoObjectSupportForDuplicateMethod",
  83.     kQ3WarningNoObjectSupportForDrawMethod,     "\pkQ3WarningNoObjectSupportForDrawMethod",
  84.     kQ3WarningNoObjectSupportForWriteMethod,     "\pkQ3WarningNoObjectSupportForWriteMethod",
  85.     kQ3WarningNoObjectSupportForReadMethod,     "\pkQ3WarningNoObjectSupportForReadMethod",
  86.     kQ3WarningUnknownElementType,                 "\pkQ3WarningUnknownElementType",
  87.     kQ3WarningTypeAndMethodAlreadyDefined,         "\pkQ3WarningTypeAndMethodAlreadyDefined",
  88.     kQ3WarningTypeIsOutOfRange,                 "\pkQ3WarningTypeIsOutOfRange",
  89.     kQ3WarningTypeHasNotBeenRegistered,         "\pkQ3WarningTypeHasNotBeenRegistered",
  90.     /* Parameter Warnings */
  91.     kQ3WarningVector3DNotUnitLength,             "\pkQ3WarningVector3DNotUnitLength",
  92.     /* IO Warnings */
  93.     kQ3WarningInvalidSubObjectForObject,         "\pkQ3WarningInvalidSubObjectForObject",
  94.     kQ3WarningInvalidHexString,                 "\pkQ3WarningInvalidHexString",
  95.     kQ3WarningUnknownObject,                     "\pkQ3WarningUnknownObject",
  96.     kQ3WarningInvalidMetafileObject,             "\pkQ3WarningInvalidMetafileObject",
  97.     kQ3WarningUnmatchedBeginGroup,                 "\pkQ3WarningUnmatchedBeginGroup",
  98.     kQ3WarningUnmatchedEndGroup,                 "\pkQ3WarningUnmatchedEndGroup",
  99.     kQ3WarningInvalidTableOfContents,             "\pkQ3WarningInvalidTableOfContents",
  100.     kQ3WarningUnresolvableReference,             "\pkQ3WarningUnresolvableReference",
  101.     kQ3WarningNoAttachMethod,                     "\pkQ3WarningNoAttachMethod",
  102.     kQ3WarningInconsistentData,                 "\pkQ3WarningInconsistentData",
  103.     kQ3WarningReadLessThanSize,                 "\pkQ3WarningReadLessThanSize",
  104.     kQ3WarningFilePointerResolutionFailed,         "\pkQ3WarningFilePointerResolutionFailed",
  105.     kQ3WarningFilePointerRedefined,             "\pkQ3WarningFilePointerRedefined",
  106.     kQ3WarningStringExceedsMaximumLength,         "\pkQ3WarningStringExceedsMaximumLength",
  107.     /* Memory Warnings */
  108.     kQ3WarningLowMemory,                         "\pkQ3WarningLowMemory",
  109.     kQ3WarningPossibleMemoryLeak,                 "\pkQ3WarningPossibleMemoryLeak",
  110.     /* View Warnings */
  111.     kQ3WarningViewTraversalInProgress,             "\pkQ3WarningViewTraversalInProgress",
  112.     kQ3WarningNonInvertibleMatrix,                 "\pkQ3WarningNonInvertibleMatrix",
  113.     /* Quaternion Warning */
  114.     kQ3WarningQuaternionEntriesAreZero,         "\pkQ3WarningQuaternionEntriesAreZero",
  115.     /* Renderer Warning */
  116.     kQ3WarningFunctionalityNotSupported,         "\pkQ3WarningFunctionalityNotSupported",
  117.     /* DrawContext Warning */
  118.     kQ3WarningInvalidPaneDimensions,             "\pkQ3WarningInvalidPaneDimensions",
  119.     /* Pick Warning */
  120.     kQ3WarningPickParamOutside,                 "\pkQ3WarningPickParamOutside",
  121.     /* Scale Warnings */
  122.     kQ3WarningScaleEntriesAllZero,                 "\pkQ3WarningScaleEntriesAllZero",
  123.     kQ3WarningScaleContainsNegativeEntries,     "\pkQ3WarningScaleContainsNegativeEntries",
  124.     /* Generic Warnings */
  125.     kQ3WarningParameterOutOfRange,                 "\pkQ3WarningParameterOutOfRange"
  126. } ;
  127.  
  128.  
  129. struct {
  130.     TQ3Error    theError ;
  131.     Str255        theString ;
  132. } errorTable[] = {
  133.     kQ3ErrorNone,                            "\pkQ3ErrorNone",        
  134.     /* Fatal Errors */
  135.     kQ3ErrorInternalError,                    "\pkQ3ErrorInternalError",
  136.     kQ3ErrorNoRecovery,                        "\pkQ3ErrorNoRecovery",
  137.     kQ3ErrorLastFatalError,                    "\pkQ3ErrorLastFatalError",
  138.     /* System Errors */
  139.     kQ3ErrorNotInitialized,                    "\pkQ3ErrorNotInitialized",
  140.     kQ3ErrorAlreadyInitialized,                "\pkQ3ErrorAlreadyInitialized",
  141.     kQ3ErrorUnimplemented,                    "\pkQ3ErrorUnimplemented",
  142.     kQ3ErrorRegistrationFailed,                "\pkQ3ErrorRegistrationFailed",
  143.     /* OS Errors */
  144.     kQ3ErrorUnixError,                        "\pkQ3ErrorUnixError",
  145.     kQ3ErrorMacintoshError,                    "\pkQ3ErrorMacintoshError",
  146.     kQ3ErrorX11Error,                        "\pkQ3ErrorX11Error",
  147.     /* Memory Errors */
  148.     kQ3ErrorMemoryLeak,                        "\pkQ3ErrorMemoryLeak",
  149.     kQ3ErrorOutOfMemory,                    "\pkQ3ErrorOutOfMemory",
  150.     /* Parameter errors */
  151.     kQ3ErrorNULLParameter,                    "\pkQ3ErrorNULLParameter",
  152.     kQ3ErrorParameterOutOfRange,            "\pkQ3ErrorParameterOutOfRange",
  153.     kQ3ErrorInvalidParameter,                "\pkQ3ErrorInvalidParameter",            
  154.     kQ3ErrorInvalidData,                    "\pkQ3ErrorInvalidData",                
  155.     kQ3ErrorAcceleratorAlreadySet,            "\pkQ3ErrorAcceleratorAlreadySet",        
  156.     kQ3ErrorVector3DNotUnitLength,            "\pkQ3ErrorVector3DNotUnitLength",
  157.     kQ3ErrorVector3DZeroLength,                "\pkQ3ErrorVector3DZeroLength",
  158.     /* Object Errors */
  159.     kQ3ErrorInvalidObject,                    "\pkQ3ErrorInvalidObject",
  160.     kQ3ErrorInvalidObjectClass,                "\pkQ3ErrorInvalidObjectClass",
  161.     kQ3ErrorInvalidObjectType,                "\pkQ3ErrorInvalidObjectType",
  162.     kQ3ErrorInvalidObjectName,                "\pkQ3ErrorInvalidObjectName",
  163.     kQ3ErrorObjectClassInUse,                "\pkQ3ErrorObjectClassInUse",            
  164.     kQ3ErrorAccessRestricted,                "\pkQ3ErrorAccessRestricted",
  165.     kQ3ErrorMetaHandlerRequired,            "\pkQ3ErrorMetaHandlerRequired",
  166.     kQ3ErrorNeedRequiredMethods,            "\pkQ3ErrorNeedRequiredMethods",
  167.     kQ3ErrorNoSubClassType,                    "\pkQ3ErrorNoSubClassType",
  168.     kQ3ErrorUnknownElementType,                "\pkQ3ErrorUnknownElementType",
  169.     kQ3ErrorNotSupported,                    "\pkQ3ErrorNotSupported",
  170.     /* Extension Errors */
  171.     kQ3ErrorNoExtensionsFolder,                "\pkQ3ErrorNoExtensionsFolder",
  172.     kQ3ErrorExtensionError,                    "\pkQ3ErrorExtensionError",
  173.     kQ3ErrorPrivateExtensionError,            "\pkQ3ErrorPrivateExtensionError",
  174.     /* Geometry Errors */
  175.     kQ3ErrorDegenerateGeometry,                "\pkQ3ErrorDegenerateGeometry",
  176.     kQ3ErrorGeometryInsufficientNumberOfPoints,    "\pkQ3ErrorGeometryInsufficientNumberOfPoints",
  177.     /* IO Errors */
  178.     kQ3ErrorNoStorageSetForFile,            "\pkQ3ErrorNoStorageSetForFile",
  179.     kQ3ErrorEndOfFile,                        "\pkQ3ErrorEndOfFile",
  180.     kQ3ErrorFileCancelled,                    "\pkQ3ErrorFileCancelled",
  181.     kQ3ErrorInvalidMetafile,                "\pkQ3ErrorInvalidMetafile",
  182.      kQ3ErrorInvalidMetafilePrimitive,        "\pkQ3ErrorInvalidMetafilePrimitive",
  183.      kQ3ErrorInvalidMetafileLabel,            "\pkQ3ErrorInvalidMetafileLabel",
  184.      kQ3ErrorInvalidMetafileObject,            "\pkQ3ErrorInvalidMetafileObject",
  185.      kQ3ErrorInvalidMetafileSubObject,        "\pkQ3ErrorInvalidMetafileSubObject",
  186.     kQ3ErrorInvalidSubObjectForObject,        "\pkQ3ErrorInvalidSubObjectForObject",
  187.     kQ3ErrorUnresolvableReference,            "\pkQ3ErrorUnresolvableReference",
  188.     kQ3ErrorUnknownObject,                    "\pkQ3ErrorUnknownObject",
  189.     kQ3ErrorStorageInUse,                    "\pkQ3ErrorStorageInUse",
  190.     kQ3ErrorStorageAlreadyOpen,                "\pkQ3ErrorStorageAlreadyOpen",
  191.     kQ3ErrorStorageNotOpen,                    "\pkQ3ErrorStorageNotOpen",
  192.     kQ3ErrorStorageIsOpen,                    "\pkQ3ErrorStorageIsOpen",
  193.     kQ3ErrorFileAlreadyOpen,                "\pkQ3ErrorFileAlreadyOpen",
  194.     kQ3ErrorFileNotOpen,                    "\pkQ3ErrorFileNotOpen",
  195.     kQ3ErrorFileIsOpen,                        "\pkQ3ErrorFileIsOpen",
  196.     kQ3ErrorBeginWriteAlreadyCalled,        "\pkQ3ErrorBeginWriteAlreadyCalled",
  197.     kQ3ErrorBeginWriteNotCalled,            "\pkQ3ErrorBeginWriteNotCalled",
  198.     kQ3ErrorEndWriteNotCalled,                "\pkQ3ErrorEndWriteNotCalled",
  199.     kQ3ErrorReadStateInactive,                "\pkQ3ErrorReadStateInactive",
  200.     kQ3ErrorStateUnavailable,                "\pkQ3ErrorStateUnavailable",
  201.     kQ3ErrorWriteStateInactive,                "\pkQ3ErrorWriteStateInactive",
  202.     kQ3ErrorSizeNotLongAligned,                "\pkQ3ErrorSizeNotLongAligned",
  203.     kQ3ErrorFileModeRestriction,            "\pkQ3ErrorFileModeRestriction",
  204.     kQ3ErrorInvalidHexString,                "\pkQ3ErrorInvalidHexString",
  205.     kQ3ErrorWroteMoreThanSize,                "\pkQ3ErrorWroteMoreThanSize",
  206.     kQ3ErrorWroteLessThanSize,                "\pkQ3ErrorWroteLessThanSize",
  207.     kQ3ErrorReadLessThanSize,                "\pkQ3ErrorReadLessThanSize",
  208.     kQ3ErrorReadMoreThanSize,                "\pkQ3ErrorReadMoreThanSize",
  209.     kQ3ErrorNoBeginGroup,                    "\pkQ3ErrorNoBeginGroup",
  210.     kQ3ErrorSizeMismatch,                    "\pkQ3ErrorSizeMismatch",
  211.     kQ3ErrorStringExceedsMaximumLength,        "\pkQ3ErrorStringExceedsMaximumLength",
  212.     kQ3ErrorValueExceedsMaximumSize,        "\pkQ3ErrorValueExceedsMaximumSize",
  213.     kQ3ErrorNonUniqueLabel,                    "\pkQ3ErrorNonUniqueLabel",
  214.     kQ3ErrorEndOfContainer,                    "\pkQ3ErrorEndOfContainer",
  215.     kQ3ErrorUnmatchedEndGroup,                "\pkQ3ErrorUnmatchedEndGroup",
  216.     kQ3ErrorFileVersionExists,                "\pkQ3ErrorFileVersionExists",
  217.     /* View errors */
  218.     kQ3ErrorViewNotStarted,                    "\pkQ3ErrorViewNotStarted",
  219.     kQ3ErrorViewIsStarted,                    "\pkQ3ErrorViewIsStarted",
  220.     kQ3ErrorRendererNotSet,                    "\pkQ3ErrorRendererNotSet",
  221.     kQ3ErrorRenderingIsActive,                "\pkQ3ErrorRenderingIsActive",
  222.     kQ3ErrorImmediateModeUnderflow,            "\pkQ3ErrorImmediateModeUnderflow",
  223.     kQ3ErrorDisplayNotSet,                    "\pkQ3ErrorDisplayNotSet",
  224.     kQ3ErrorCameraNotSet,                    "\pkQ3ErrorCameraNotSet",
  225.     kQ3ErrorDrawContextNotSet,                "\pkQ3ErrorDrawContextNotSet",
  226.     kQ3ErrorNonInvertibleMatrix,            "\pkQ3ErrorNonInvertibleMatrix",
  227.     kQ3ErrorRenderingNotStarted,            "\pkQ3ErrorRenderingNotStarted",
  228.     kQ3ErrorPickingNotStarted,                "\pkQ3ErrorPickingNotStarted",
  229.     kQ3ErrorBoundsNotStarted,                "\pkQ3ErrorBoundsNotStarted",
  230.     kQ3ErrorDataNotAvailable,                "\pkQ3ErrorDataNotAvailable",
  231.     kQ3ErrorNothingToPop,                    "\pkQ3ErrorNothingToPop",
  232.     /* Renderer Errors */
  233.     kQ3ErrorUnknownStudioType,                "\pkQ3ErrorUnknownStudioType",            
  234.     kQ3ErrorAlreadyRendering,                "\pkQ3ErrorAlreadyRendering",
  235.     kQ3ErrorStartGroupRange,                "\pkQ3ErrorStartGroupRange",
  236.     kQ3ErrorUnsupportedGeometryType,        "\pkQ3ErrorUnsupportedGeometryType",
  237.     kQ3ErrorInvalidGeometryType,            "\pkQ3ErrorInvalidGeometryType",
  238.     kQ3ErrorUnsupportedFunctionality,        "\pkQ3ErrorUnsupportedFunctionality",
  239.     /* Group Errors */
  240.     kQ3ErrorInvalidPositionForGroup,        "\pkQ3ErrorInvalidPositionForGroup",
  241.     kQ3ErrorInvalidObjectForGroup,            "\pkQ3ErrorInvalidObjectForGroup",
  242.     kQ3ErrorInvalidObjectForPosition,        "\pkQ3ErrorInvalidObjectForPosition",
  243.     /* Transform Errors */
  244.     kQ3ErrorScaleOfZero,                    "\pkQ3ErrorScaleOfZero",                
  245.     /* String Errors */
  246.     kQ3ErrorBadStringType,                    "\pkQ3ErrorBadStringType",                
  247.     /* Attribute Errors */
  248.     kQ3ErrorAttributeNotContained,            "\pkQ3ErrorAttributeNotContained",        
  249.     kQ3ErrorAttributeInvalidType,            "\pkQ3ErrorAttributeInvalidType",        
  250.     /* Camera Errors */
  251.     kQ3ErrorInvalidCameraValues,            "\pkQ3ErrorInvalidCameraValues",        
  252.     /* DrawContext Errors */
  253.     kQ3ErrorBadDrawContextType,                "\pkQ3ErrorBadDrawContextType",
  254.     kQ3ErrorBadDrawContextFlag,                "\pkQ3ErrorBadDrawContextFlag",
  255.     kQ3ErrorBadDrawContext,                    "\pkQ3ErrorBadDrawContext",
  256.     kQ3ErrorUnsupportedPixelDepth,            "\pkQ3ErrorUnsupportedPixelDepth"
  257.  
  258. } ;
  259.  
  260.  
  261.  
  262.  
  263.  
  264. static void ConcatenateString( Str255 firstString, Str255 addThis ) ;
  265. static void CopyString( Str255 firstString, Str255 fromThis ) ;
  266. static void PresentErrMsgInDialog( Str255 theError ) ;
  267.  
  268.  
  269. //-------------------------------------------------------------------------------------------
  270. // MyErrorHandler - handle warnings from QuickDraw 3d
  271. void MyErrorHandler( TQ3Error sticky, TQ3Error latest, long refCon )
  272. {
  273. #ifndef DONT_WARN_ME
  274.  
  275.     Str255     myErrorStr ;
  276.     Str255    theWholeString ;
  277.  
  278.     short    stickyIndex = sticky - kQ3ErrorInternalError ;
  279.     short    latestIndex = latest - kQ3ErrorInternalError ;
  280.     
  281.     // if the error is out of range, then just tell us that something
  282.     // "unknown" happened. Otherwise look up the error from the table.
  283.     if( sticky != kQ3ErrorNone && ( sticky < kQ3ErrorInternalError || sticky > kQ3ErrorUnsupportedPixelDepth )) {
  284.         CopyString(    theWholeString, stringTable[kErrorString].errorString  ) ;
  285.         ConcatenateString( theWholeString, stringTable[ kUnknownErrorString ].errorString ) ;
  286.     }
  287.     else {
  288.         
  289.         
  290.         CopyString(    theWholeString, stringTable[ kErrorString ].errorString  ) ;
  291.         
  292.         ConcatenateString( theWholeString, stringTable[ kFirstErrorString ].errorString ) ;
  293.         CopyString(    myErrorStr, errorTable[ stickyIndex ].theString) ;
  294.         ConcatenateString( theWholeString, myErrorStr) ;
  295.         
  296.         ConcatenateString( theWholeString, stringTable[ kLastErrorString ].errorString ) ;
  297.         CopyString(    myErrorStr, errorTable[ stickyIndex ].theString) ;
  298.         ConcatenateString( theWholeString, myErrorStr) ;
  299.         
  300.         // and display the error string 
  301.         PresentErrMsgInDialog( theWholeString ) ;
  302.     }
  303.     
  304.     // clear down the error
  305.     latest = Q3Error_Get( &sticky );
  306. #endif    
  307. }
  308.  
  309.  
  310. //-------------------------------------------------------------------------------------------
  311. // MyErrorHandler - handle warnings from QuickDraw 3d
  312. void MyWarningHandler( TQ3Warning     sticky, TQ3Warning     latest, long refCon )
  313. {
  314. #ifndef DONT_WARN_ME
  315.     Str255     myWarningStr ;
  316.     Str255    theWholeString ;
  317.  
  318.     short    stickyIndex = sticky - kQ3WarningInternalException ;
  319.     short    latestIndex = latest - kQ3WarningInternalException ;
  320.     
  321.     // if the error is out of range, then just tell us that something
  322.     // "unknown" happened. Otherwise look up the error from the table.
  323.     if( sticky != kQ3ErrorNone && ( sticky < kQ3WarningInternalException || sticky > kQ3WarningParameterOutOfRange )) {
  324.     
  325.         CopyString(    theWholeString, stringTable[ kWarningString ].errorString  ) ;
  326.         ConcatenateString( theWholeString, stringTable[ kUnknownErrorString ].errorString ) ;
  327.         
  328.     }
  329.     else {
  330.         
  331.         CopyString(    theWholeString, stringTable[ kWarningString ].errorString  ) ;
  332.         
  333.         ConcatenateString( theWholeString, stringTable[ kFirstErrorString ].errorString ) ;
  334.         CopyString(    myWarningStr, warningTable[ stickyIndex ].theString) ;
  335.         ConcatenateString( theWholeString, myWarningStr) ;
  336.         
  337.         ConcatenateString( theWholeString, stringTable[ kLastErrorString ].errorString ) ;
  338.         CopyString(    myWarningStr, warningTable[ stickyIndex ].theString) ;
  339.         ConcatenateString( theWholeString, myWarningStr) ;
  340.         
  341.         PresentErrMsgInDialog( theWholeString ) ;    
  342.     }
  343.     
  344.     // clear down the error
  345.     latest = Q3Warning_Get( &sticky );
  346.     
  347. #endif
  348. }
  349.  
  350. //------------------------------------------------------------------------
  351. static void ConcatenateString( Str255 firstString, Str255 addThis )
  352. {
  353.     BlockMove( &addThis[1], &firstString[firstString[0]+1], addThis[0] ) ;
  354.     firstString[0] += addThis[0] ;
  355. }
  356.  
  357.  
  358. //------------------------------------------------------------------------
  359. static void CopyString( Str255 firstString, Str255 fromThis )
  360. {
  361.     BlockMove( &fromThis[1], &firstString[1], fromThis[0] ) ;
  362.     firstString[0] = fromThis[0] ;
  363. }
  364.  
  365. //------------------------------------------------------------------------
  366.  
  367. static void PresentErrMsgInDialog( Str255 theError )
  368. {    
  369.     short    itemHit ;
  370.     ParamText( theError, 0L,  0L,  0L ) ;
  371.     itemHit = StopAlert( kErrorHandlerAlertID, nil ) ;
  372.     
  373.     if( itemHit == 2 ) 
  374.         ExitToShell() ;
  375.     else if( itemHit == 3 ) 
  376.         Debugger() ;
  377.         
  378. }